﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace ScrumTracker.Models
{
    [MetadataType(typeof(StoryMetadata))]
    public partial class Story
    {
        [ScaffoldColumn(false)]
        public int EstimatedHours
        {
            get
            {
                return this.Tasks.Sum(t => t.EstimatedHours) ?? 0;
            }
        }

        [ScaffoldColumn(false)]
        public decimal RemainingHours
        {
            get
            {
                return EstimatedHours - this.Tasks.Sum(t => (t.EstimatedHours * t.PercentDone)) ?? 0;
            }
        }

        //public new string Assignee { get; set; }
    }


    public enum StoryType : byte
    {
        Feature = 1,
        Bug = 2,
        TechnicalWork = 4,
        KnowledgeAquisition = 8
    }
}